/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Client;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * Created with IntelliJ IDEA.
 * User: Anastasia
 * Date: 16.12.14
 * Time: 12:11
 * To change this template use File | Settings | File Templates.
 */
public class Delete  extends JFrame implements ActionListener {

    private JButton button;
    private  JPanel panel = new JPanel();
    private JLabel label;
    private JTextField input;
   private  JList list ;



    public void actionPerformed(ActionEvent arg0)
    {

      try{
        InetAddress addr = InetAddress.getByName(null);

        Socket socket = new Socket(addr, 8080);

        //         BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        PrintWriter outer = new PrintWriter(new BufferedWriter(
                new OutputStreamWriter(socket.getOutputStream())), true);
        outer.println(2);  //это будет команда


        socket.close();  }

    catch(UnknownHostException e)
    {

    }

    catch(IOException e)
    {

    }


        this.setVisible(true);
        setBounds(600,600,700,700);
        panel = new JPanel();
        panel.setLayout(null);

        list = new JList() ;
        list.setLayoutOrientation(JList.VERTICAL);
       list.setBounds(45, 150, 200,100);
        panel.add(list);

        button = new JButton("Удалить");
        button.setBounds(45,100,200,30);
        panel.add(button);


       label = new JLabel("Индекс удаляемого сотрудника");
        label.setBounds(20,50,80,30);
        panel.add(label) ;



        input = new JTextField();
        input.setBounds(120, 50, 200, 30);

        panel.add(input);


        panel.validate();



        this.add(panel);
        setPreferredSize(new Dimension(500, 800));


    }
}
